From 04d0fece67cf8c4e77b370a9e47636a9b6d53798 Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild.aw" Date: Tue, 5 Dec 2006 09:44:24 -0700 Subject: [PATCH] [IA64] Fix VTi domain creation Signed-off-by: Zhang Xin --- tools/libxc/ia64/xc_ia64_hvm_build.c | 10 ++++++---- tools/python/xen/lowlevel/xc/xc.c | 13 ++++++++++++- xen/include/public/arch-ia64.h | 7 +++++++ 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/tools/libxc/ia64/xc_ia64_hvm_build.c b/tools/libxc/ia64/xc_ia64_hvm_build.c index 325442b1b4..a38728d73a 100644 --- a/tools/libxc/ia64/xc_ia64_hvm_build.c +++ b/tools/libxc/ia64/xc_ia64_hvm_build.c @@ -591,6 +591,7 @@ setup_guest(int xc_handle, uint32_t dom, unsigned long memsize, unsigned long dom_memsize = ((memsize - 16) << 20); unsigned long nr_pages = (unsigned long)memsize << (20 - PAGE_SHIFT); unsigned long normal_pages = nr_pages - GFW_PAGES; + unsigned long vcpus; int rc; long i, j; DECLARE_DOMCTL; @@ -668,7 +669,6 @@ setup_guest(int xc_handle, uint32_t dom, unsigned long memsize, if (xc_domctl(xc_handle, &domctl)) goto error_out; - // Load guest firmware if (xc_ia64_copy_to_domain_pages(xc_handle, dom, image, (GFW_START + GFW_SIZE - image_size) >> PAGE_SHIFT, @@ -677,15 +677,17 @@ setup_guest(int xc_handle, uint32_t dom, unsigned long memsize, goto error_out; } + // Get number of vcpus, stored by pyxc_hvm_build() + xc_get_hvm_param(xc_handle, dom, HVM_PARAM_VCPUS, &vcpus); + // Hand-off state passed to guest firmware - if (xc_ia64_build_hob(xc_handle, dom, dom_memsize, - (unsigned long)vcpus) < 0) { + if (xc_ia64_build_hob(xc_handle, dom, dom_memsize, vcpus) < 0) { PERROR("Could not build hob\n"); goto error_out; } xc_set_hvm_param(xc_handle, dom, - HVM_PARAM_STORE_PFN, STORE_PAGE_START>>PAGE_SHIFT); + HVM_PARAM_STORE_PFN, pfn_list[nr_pages - 2]); // Retrieve special pages like io, xenstore, etc. sp = (shared_iopage_t *)xc_map_foreign_range(xc_handle, dom, PAGE_SIZE, diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index 2eb9376426..48f85aa9dc 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -374,10 +374,13 @@ static PyObject *pyxc_hvm_build(XcObject *self, PyObject *kwds) { uint32_t dom; +#if !defined(__ia64__) struct hvm_info_table *va_hvm; uint8_t *va_map, sum; + int i; +#endif char *image; - int i, store_evtchn, memsize, vcpus = 1, pae = 0, acpi = 0, apic = 1; + int store_evtchn, memsize, vcpus = 1, pae = 0, acpi = 0, apic = 1; unsigned long store_mfn; static char *kwd_list[] = { "domid", "store_evtchn", @@ -388,9 +391,14 @@ static PyObject *pyxc_hvm_build(XcObject *self, &image, &vcpus, &pae, &acpi, &apic) ) return NULL; +#if defined(__ia64__) + /* Set vcpus to later be retrieved in setup_guest() */ + xc_set_hvm_param(self->xc_handle, dom, HVM_PARAM_VCPUS, vcpus); +#endif if ( xc_hvm_build(self->xc_handle, dom, memsize, image) != 0 ) return PyErr_SetFromErrno(xc_error); +#if !defined(__ia64__) /* Set up the HVM info table. */ va_map = xc_map_foreign_range(self->xc_handle, dom, XC_PAGE_SIZE, PROT_READ | PROT_WRITE, @@ -408,9 +416,12 @@ static PyObject *pyxc_hvm_build(XcObject *self, sum += ((uint8_t *)va_hvm)[i]; va_hvm->checksum = -sum; munmap(va_map, XC_PAGE_SIZE); +#endif xc_get_hvm_param(self->xc_handle, dom, HVM_PARAM_STORE_PFN, &store_mfn); +#if !defined(__ia64__) xc_set_hvm_param(self->xc_handle, dom, HVM_PARAM_PAE_ENABLED, pae); +#endif xc_set_hvm_param(self->xc_handle, dom, HVM_PARAM_STORE_EVTCHN, store_evtchn); diff --git a/xen/include/public/arch-ia64.h b/xen/include/public/arch-ia64.h index 8125eacebb..f3b8e423b5 100644 --- a/xen/include/public/arch-ia64.h +++ b/xen/include/public/arch-ia64.h @@ -66,6 +66,13 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t); /* WARNING: before changing this, check that shared_info fits on a page */ #define MAX_VIRT_CPUS 64 +/* + * HVM_PARAM_PAE_ENABLED is meaningless on ia64, so we overload this + * entry to store the number of vCPUs. XXX Need arch-specific extentions + * for xc_get/set_hvm_param(). + */ +#define HVM_PARAM_VCPUS HVM_PARAM_PAE_ENABLED + #ifndef __ASSEMBLY__ typedef unsigned long xen_ulong_t; -- 2.30.2